/**
 * [submenuMixin description]
 * 处理 submenu 右边侧边导航栏
 * @type {Object}
 */
export const submenuMixin = {
  mounted() {
    const submenuElList = document.querySelectorAll('h2');
    const submenuData = [];
    submenuElList.forEach((item) => {
      const submemuObj = {
        subId: item.id && item.id.split('_').length === 3 ? item.id.split('_')[2] : '',
        subTitle: item.innerText,
      };
      submenuData.push(submemuObj);
    });
    this.$emit('getDoc', submenuData);
  },
}
